public class TestAddress
	{
		public static void main(String args[])
			{
				char x;
				int i,s1,len;
				String s[] = new String[7];
				for(i = 0; i < 7; i++)
				s[i] = "";

				Address add[] = new Address[4];
				Address add1 = new Address();
				add[0] = new Address("8","9","e","d","d","e","Goa","g","g");
				add[1] = new Address("8","9","e","d","d","e","g","g","g");
				add[2] = new Address("8","9","e","d","d","e","g","g","g");
				add[3] = new Address("8","9","e","d","d","e","g","g","g");
				
				String sampleAdd = new String("#3A,1-164,Ist Line,Farmagudi,Ponda,Goa,403 405");
				len = sampleAdd.length();
				s1 = 0;
				for(i = 0; i < len ; i++)
					{
						x = sampleAdd.charAt(i);
						if((x == ','))
							{
								s1++;
							}
						if((x != ','))
							{
								s[s1] = s[s1] + x;
								
							}
					}
				add1.setFlatNo(s[0]);
				add1.setDoorNo(s[1]);
				add1.setStreet(s[2]);
				add1.setDistrict(s[3]);
				add1.setCity(s[4]);
				add1.setState(s[5]);
				add1.setPinCode(s[6]);
				
				String test = new String(add1.getCity());
				System.out.println(test);
				
				displayObj(add[0]);
				int z = validatePin(add1.getPinCode());
				System.out.println(z);
				
			}

	public static int checkState(String state_tested)
			{
				String state_test = new String("Goa");	
				if(((state_test).compareTo(state_tested)) == 0)
					return 1;
				return 0; 
			}
	public static void displayObj(Address add2)
			{
				String stateTested = new String(add2.getState());
				int check;
				check = checkState(stateTested);
				if(check == 1)
					{
						System.out.println(add2.getFlatNo());
						System.out.println(add2.getDoorNo());
						System.out.println(add2.getStreet());
						System.out.println(add2.getDistrict());
						System.out.println(add2.getCity());
						System.out.println(add2.getState());
						System.out.println(add2.getFlatNo());
					}
			}
	public static int validatePin(String pin)
			{
				char x;
				int pinLen = pin.length();
				int i,count = 0,y;
				for(i = 0;i < pinLen; i++)
					{
						x = pin.charAt(i);
						y = (int)x;
						if((y < 48)||(y > 57))
							if(y != 32)
								return 0;
						if(y != 32)
							count++;
					}
				if(count < 6)
					return 0;
				return 1;
			}
	}
